package com.framework.base.taglib.page; 

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Set;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;

import org.apache.log4j.Logger;

import com.framework.base.constant.WebConstants;
import com.framework.base.util.ArrayUtil;
import com.framework.base.util.ParamsUrlUtil;
import com.framework.base.util.StringUtil;

/**
 * Description:用于将分页的属性写成hidden标签 包括当前页、排序字段、排序类型
 * tabaleName(对应的表名):
 * Company: framework
 * @author：HYH
 * @version 1.0
 * @Date Jun 11, 2011 11:15:09 PM
 */
@SuppressWarnings("serial")
public class PagePropTag extends TagSupport {
	/**
	 * 取得日志对象
	 * 
	 * @return 返回日志对象
	 */
	public Logger getLogger() {
		Logger logger = Logger.getLogger(getClass()); // 作为日志的公用对象

		return logger;
	}
	@SuppressWarnings("unchecked")
	@Override
	public int doEndTag() throws JspException {
		HttpServletRequest httpRequest = (HttpServletRequest) pageContext.getRequest();
		String content=ParamsUrlUtil.dealParamsUrl(httpRequest);
		JspWriter out = pageContext.getOut();
		try {
			System.out.println(content);
			out.print("<input type=\"hidden\" name=\""+WebConstants.PARAMSURL+"\" value=\""+content+"\">");
		} catch (IOException e) {
			e.printStackTrace();
		}
		return super.doEndTag();
	}
}